@opexa/portal-components 0.1.64 → 0.1.66
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/useInplaySignUpMutation.d.ts +5 -0
- package/dist/client/hooks/useInplaySignUpMutation.js +27 -0
- package/dist/client/hooks/useSessionQuery.js +11 -1
- package/dist/client/hooks/useSignInMutation.d.ts +2 -0
- package/dist/client/hooks/useSignInMutation.js +12 -6
- package/dist/client/services/signIn.d.ts +1 -1
- package/dist/client/services/signIn.js +11 -5
- package/dist/components/AccountInfo/AccountInfo.js +2 -2
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/OnlineBankDepositContext.d.ts +2 -2
- package/dist/components/DepositWithdrawal/Deposit/OnlineBankDeposit/useOnlineBankDeposit.d.ts +1 -1
- package/dist/components/KYC/KYCReminder.lazy.js +1 -1
- package/dist/components/SignIn/MobileNumberSignInternational.js +1 -0
- package/dist/components/SignIn/NameAndPasswordSignIn.js +1 -0
- package/dist/components/SignIn/SignIn.lazy.d.ts +3 -1
- package/dist/components/SignIn/SignIn.lazy.js +1 -1
- package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.d.ts +1 -0
- package/dist/components/SignUp/SignUpDefault/SignUpDefault.lazy.js +9 -1
- package/dist/components/SignUp/SignUpDefault/SignUpDefaultForm.js +49 -21
- package/dist/constants/Endpoint.js +7 -6
- package/dist/constants/EnvVar.d.ts +5 -0
- package/dist/constants/EnvVar.js +9 -0
- package/dist/constants/HeaderKey.d.ts +1 -0
- package/dist/constants/HeaderKey.js +1 -0
- package/dist/constants/StorageKey.d.ts +1 -0
- package/dist/constants/StorageKey.js +1 -0
- package/dist/handlers/deleteSession.d.ts +1 -1
- package/dist/handlers/deleteSession.js +6 -2
- package/dist/handlers/getSession.js +29 -4
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/postSession.js +22 -4
- package/dist/schemas/forgotPasswordSchema.d.ts +4 -4
- package/dist/services/account.d.ts +47 -0
- package/dist/services/account.js +21 -1
- package/dist/services/auth.d.ts +5 -4
- package/dist/services/auth.js +14 -9
- package/dist/services/queries.d.ts +1 -0
- package/dist/services/queries.js +44 -0
- package/dist/ui/AlertDialog/AlertDialog.d.ts +121 -121
- package/dist/ui/AlertDialog/alertDialog.recipe.d.ts +11 -11
- package/dist/ui/Avatar/Avatar.d.ts +9 -9
- package/dist/ui/Avatar/avatar.recipe.d.ts +3 -3
- package/dist/ui/Badge/Badge.d.ts +12 -12
- package/dist/ui/Badge/badge.anatomy.d.ts +1 -1
- package/dist/ui/Badge/badge.recipe.d.ts +3 -3
- package/dist/ui/Carousel/Carousel.d.ts +72 -72
- package/dist/ui/Carousel/carousel.recipe.d.ts +8 -8
- package/dist/ui/Checkbox/Checkbox.d.ts +23 -23
- package/dist/ui/Checkbox/checkbox.recipe.d.ts +3 -3
- package/dist/ui/Clipboard/Clipboard.d.ts +18 -18
- package/dist/ui/Clipboard/clipboard.recipe.d.ts +3 -3
- package/dist/ui/Collapsible/Collapsible.d.ts +20 -20
- package/dist/ui/Collapsible/collapsible.recipe.d.ts +5 -5
- package/dist/ui/Combobox/Combobox.d.ts +42 -42
- package/dist/ui/Combobox/combobox.recipe.d.ts +3 -3
- package/dist/ui/DatePicker/DatePicker.d.ts +72 -72
- package/dist/ui/DatePicker/datePicker.recipe.d.ts +3 -3
- package/dist/ui/Dialog/Dialog.d.ts +33 -33
- package/dist/ui/Dialog/dialog.recipe.d.ts +3 -3
- package/dist/ui/Drawer/Drawer.d.ts +33 -33
- package/dist/ui/Drawer/drawer.recipe.d.ts +3 -3
- package/dist/ui/Field/Field.d.ts +21 -21
- package/dist/ui/Field/field.recipe.d.ts +3 -3
- package/dist/ui/Menu/Menu.d.ts +144 -144
- package/dist/ui/Menu/menu.recipe.d.ts +8 -8
- package/dist/ui/NumberInput/NumberInput.d.ts +24 -24
- package/dist/ui/NumberInput/numberInput.recipe.d.ts +3 -3
- package/dist/ui/PasswordInput/PasswordInput.d.ts +18 -18
- package/dist/ui/PasswordInput/passwordInput.recipe.d.ts +3 -3
- package/dist/ui/PinInput/PinInput.d.ts +12 -12
- package/dist/ui/PinInput/pinInput.recipe.d.ts +3 -3
- package/dist/ui/Popover/Popover.d.ts +88 -88
- package/dist/ui/Popover/popover.recipe.d.ts +8 -8
- package/dist/ui/Progress/Progress.d.ts +27 -27
- package/dist/ui/Progress/progress.recipe.d.ts +3 -3
- package/dist/ui/QrCode/QrCode.d.ts +25 -25
- package/dist/ui/QrCode/qrCode.recipe.d.ts +5 -5
- package/dist/ui/SegmentGroup/SegmentGroup.d.ts +18 -18
- package/dist/ui/SegmentGroup/segmentGroup.recipe.d.ts +3 -3
- package/dist/ui/Select/Select.d.ts +45 -45
- package/dist/ui/Select/select.recipe.d.ts +3 -3
- package/dist/ui/Table/Table.d.ts +21 -21
- package/dist/ui/Table/table.anatomy.d.ts +1 -1
- package/dist/ui/Table/table.recipe.d.ts +3 -3
- package/dist/ui/Tabs/Tabs.d.ts +15 -15
- package/dist/ui/Tabs/tabs.recipe.d.ts +3 -3
- package/package.json +2 -1
package/dist/handlers/index.d.ts
CHANGED
|
@@ -18,14 +18,14 @@ export declare const GET: (req: NextRequest, { params }: Context) => Promise<Nex
|
|
|
18
18
|
__error?: unknown;
|
|
19
19
|
} | {
|
|
20
20
|
ok: true;
|
|
21
|
-
data:
|
|
21
|
+
data: import("../types").Session;
|
|
22
22
|
}> | NextResponse<{
|
|
23
23
|
ok: false;
|
|
24
24
|
message: string;
|
|
25
25
|
__error?: unknown;
|
|
26
26
|
} | {
|
|
27
27
|
ok: true;
|
|
28
|
-
data:
|
|
28
|
+
data: Record<string, unknown>;
|
|
29
29
|
}>>;
|
|
30
30
|
export declare const DELETE: (req: NextRequest, { params }: Context) => Promise<NextResponse<{
|
|
31
31
|
ok: true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { addDays, addMinutes, subMinutes } from 'date-fns';
|
|
2
2
|
import { NextResponse } from 'next/server';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { ACCESS_TOKEN_COOKIE_NAME, API_VERSION_HEADER_KEY, DOMAIN_HEADER_KEY, FINGERPRINT_HEADER_KEY, GOOGLE_FRAUD_DEFENSE_HEADER_KEY, PLATFORM_WEB_HEADER_KEY, RECAPTCHA_HEADER_KEY, REFRESH_TOKEN_COOKIE_NAME, SESSION_VERSION_HEADER_KEY, } from '../constants/index.js';
|
|
4
|
+
import { ACCESS_TOKEN_COOKIE_NAME, API_VERSION_HEADER_KEY, AUTH_API_BASE_URL_HEADER_KEY, AUTH_CONFIG_COOKIE_NAME, DOMAIN_HEADER_KEY, FINGERPRINT_HEADER_KEY, GOOGLE_FRAUD_DEFENSE_HEADER_KEY, PLATFORM_WEB_HEADER_KEY, RECAPTCHA_HEADER_KEY, REFRESH_TOKEN_COOKIE_NAME, SESSION_VERSION_HEADER_KEY, } from '../constants/index.js';
|
|
5
5
|
import { createSession, } from '../services/auth.js';
|
|
6
6
|
const CreateSessionDefinition = z.union([
|
|
7
7
|
z.object({
|
|
@@ -44,8 +44,17 @@ export async function postSession(request) {
|
|
|
44
44
|
const fingerprint = request.headers.get(FINGERPRINT_HEADER_KEY);
|
|
45
45
|
const versionSessionHeader = request.headers.get(SESSION_VERSION_HEADER_KEY);
|
|
46
46
|
const versionSession = versionSessionHeader === 'Inplay' ? 'Inplay' : 'default';
|
|
47
|
+
const authApiBaseUrl = request.headers.get(AUTH_API_BASE_URL_HEADER_KEY);
|
|
47
48
|
const version = request.headers.get(API_VERSION_HEADER_KEY) === '4' ? 4 : 1;
|
|
48
49
|
const isWeb = request.headers.get(PLATFORM_WEB_HEADER_KEY) === 'true';
|
|
50
|
+
console.log('[CREATE SESSION]');
|
|
51
|
+
console.log({
|
|
52
|
+
versionSession,
|
|
53
|
+
version,
|
|
54
|
+
authApiBaseUrl,
|
|
55
|
+
fingerprint,
|
|
56
|
+
isWeb,
|
|
57
|
+
});
|
|
49
58
|
try {
|
|
50
59
|
const googleFraudDefense = request.headers.get(GOOGLE_FRAUD_DEFENSE_HEADER_KEY);
|
|
51
60
|
const recaptchaToken = googleFraudDefense ?? recaptcha;
|
|
@@ -69,7 +78,7 @@ export async function postSession(request) {
|
|
|
69
78
|
...(channel && { Channel: channel }),
|
|
70
79
|
...(isWeb && { [PLATFORM_WEB_HEADER_KEY]: 'true' }),
|
|
71
80
|
},
|
|
72
|
-
}, versionSession, version);
|
|
81
|
+
}, versionSession, version, authApiBaseUrl);
|
|
73
82
|
if (res.authenticator) {
|
|
74
83
|
return NextResponse.json({
|
|
75
84
|
ok: true,
|
|
@@ -78,12 +87,21 @@ export async function postSession(request) {
|
|
|
78
87
|
}
|
|
79
88
|
const response = NextResponse.json({ ok: true, data: null }, { status: 201 });
|
|
80
89
|
response.cookies.set(ACCESS_TOKEN_COOKIE_NAME, res.accessToken, {
|
|
81
|
-
expires: addMinutes(new Date(), 9),
|
|
90
|
+
expires: addMinutes(new Date(), version === 4 ? 4 : 9),
|
|
82
91
|
httpOnly: true,
|
|
83
92
|
sameSite: 'strict',
|
|
84
93
|
});
|
|
94
|
+
const _15d = subMinutes(addDays(new Date(), version === 4 ? 15 : 1), 2);
|
|
85
95
|
response.cookies.set(REFRESH_TOKEN_COOKIE_NAME, res.refreshToken, {
|
|
86
|
-
expires:
|
|
96
|
+
expires: _15d,
|
|
97
|
+
httpOnly: true,
|
|
98
|
+
sameSite: 'strict',
|
|
99
|
+
});
|
|
100
|
+
response.cookies.set(AUTH_CONFIG_COOKIE_NAME, JSON.stringify({
|
|
101
|
+
version,
|
|
102
|
+
authApiBaseUrl,
|
|
103
|
+
}), {
|
|
104
|
+
expires: _15d,
|
|
87
105
|
httpOnly: true,
|
|
88
106
|
sameSite: 'strict',
|
|
89
107
|
});
|
|
@@ -8,24 +8,24 @@ export declare const createForgotPasswordSchema: (mobileNumberParser: MobileNumb
|
|
|
8
8
|
mobileNumber: z.ZodEffects<z.ZodString, string, string>;
|
|
9
9
|
verificationCode: z.ZodEffects<z.ZodString, string, string>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
password: string;
|
|
11
12
|
mobileNumber: string;
|
|
12
13
|
verificationCode: string;
|
|
13
|
-
password: string;
|
|
14
14
|
confirmPassword: string;
|
|
15
15
|
}, {
|
|
16
|
+
password: string;
|
|
16
17
|
mobileNumber: string;
|
|
17
18
|
verificationCode: string;
|
|
18
|
-
password: string;
|
|
19
19
|
confirmPassword: string;
|
|
20
20
|
}>, {
|
|
21
|
+
password: string;
|
|
21
22
|
mobileNumber: string;
|
|
22
23
|
verificationCode: string;
|
|
23
|
-
password: string;
|
|
24
24
|
confirmPassword: string;
|
|
25
25
|
}, {
|
|
26
|
+
password: string;
|
|
26
27
|
mobileNumber: string;
|
|
27
28
|
verificationCode: string;
|
|
28
|
-
password: string;
|
|
29
29
|
confirmPassword: string;
|
|
30
30
|
}>;
|
|
31
31
|
export type ForgotPasswordSchema = z.infer<ReturnType<typeof createForgotPasswordSchema>>;
|
|
@@ -105,6 +105,53 @@ export interface RegisterMemberAccountByMobileNumberMutation {
|
|
|
105
105
|
}
|
|
106
106
|
export type RegisterMemberAccountByMobileNumberInput = Simplify<RegisterMemberAccountByMobileNumberMutationVariables['input'] & Pick<RegisterMemberAccountByMobileNumberMutationVariables, 'mobileNumberVerificationCode'>>;
|
|
107
107
|
export declare const registerMemberAccountByMobileNumber: (input: RegisterMemberAccountByMobileNumberInput, options?: GraphQLRequestOptions) => Promise<void>;
|
|
108
|
+
export type RegisterMemberAccountByMobileNumberInplayError = {
|
|
109
|
+
name: 'AccountNameNotAvailableError';
|
|
110
|
+
message: string;
|
|
111
|
+
} | {
|
|
112
|
+
name: 'MobileNumberNotAvailableError';
|
|
113
|
+
message: string;
|
|
114
|
+
} | {
|
|
115
|
+
name: 'EmailAddressNotAvailableError';
|
|
116
|
+
message: string;
|
|
117
|
+
} | {
|
|
118
|
+
name: 'InvalidMobileNumberVerificationCodeError';
|
|
119
|
+
message: string;
|
|
120
|
+
} | {
|
|
121
|
+
name: 'InvalidAgentCodeError';
|
|
122
|
+
message: string;
|
|
123
|
+
} | {
|
|
124
|
+
name: 'InvalidPlatformError';
|
|
125
|
+
message: string;
|
|
126
|
+
} | {
|
|
127
|
+
name: 'ReCAPTCHAVerificationFailedError';
|
|
128
|
+
message: string;
|
|
129
|
+
} | {
|
|
130
|
+
name: 'MemberAccountAlreadyExistsError';
|
|
131
|
+
message: string;
|
|
132
|
+
};
|
|
133
|
+
export interface RegisterMemberAccountByMobileNumberInplayMutation {
|
|
134
|
+
registerMemberAccountByMobileNumber?: null | RegisterMemberAccountByMobileNumberInplayError;
|
|
135
|
+
}
|
|
136
|
+
export interface RegisterMemberAccountByMobileNumberInplayMutationVariables {
|
|
137
|
+
input: {
|
|
138
|
+
id: string;
|
|
139
|
+
mobileNumber: string;
|
|
140
|
+
emailAddress?: string;
|
|
141
|
+
branchCode?: string;
|
|
142
|
+
mobileNumberVerificationCode: string;
|
|
143
|
+
agentCode?: string;
|
|
144
|
+
gigRewardsQuestDetails?: {
|
|
145
|
+
gigUserId: string;
|
|
146
|
+
};
|
|
147
|
+
cellxpertCxd?: string;
|
|
148
|
+
realName?: string;
|
|
149
|
+
dateOfBirth?: string;
|
|
150
|
+
};
|
|
151
|
+
referralCode?: string;
|
|
152
|
+
}
|
|
153
|
+
export type RegisterMemberAccountByMobileNumberInplayInput = Simplify<RegisterMemberAccountByMobileNumberInplayMutationVariables['input'] & Pick<RegisterMemberAccountByMobileNumberInplayMutationVariables, 'referralCode'>>;
|
|
154
|
+
export declare const registerMemberAccountByMobileNumberInplay: (input: RegisterMemberAccountByMobileNumberInplayInput, options?: GraphQLRequestOptions) => Promise<void>;
|
|
108
155
|
export interface RegisterMemberAccountMutationVariables__Next {
|
|
109
156
|
input: {
|
|
110
157
|
id: string;
|
package/dist/services/account.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cache } from 'react';
|
|
2
2
|
import { ACCOUNT_GRAPHQL_ENDPOINT } from '../constants/index.js';
|
|
3
3
|
import { graphqlRequest } from './graphqlRequest.js';
|
|
4
|
-
import { ANNOUNCEMENTS, APPROVE_MEMBER_VERIFICATION__NEXT, CREATE_MEMBER_VERIFICATION, CREATE_MEMBER_VERIFICATION__NEXT, DELETE_MEMBER_ACCOUNT, FACEBOOK_CLIENT_ID, GENERATE_SUMSUB_VERIFICATION_TOKEN, GOOGLE_CLIENT_ID, MEMBER_ACCOUNT, MEMBER_VERIFICATION, PAYMENT_SETTINGS, POINTS_CLUB_SETTINGS, PROFILE_COMPLETION, REFERRAL_CODE, REGISTER_AGENT_ACCOUNT, REGISTER_MAYA_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT__NEXT, REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER, REGISTER_MEMBER_ACCOUNT_BY_NAME, REGISTER_MEMBER_ACCOUNT_VIA_MOBILE, REQUIRE_FIRST_DEPOSIT, RESET_PASSWORD, RESTRICT_WITHDRAWALS_TO_VERIFIED_MEMBERS, UNLINK_FACEBOOK, UNLINK_GOOGLE, UPDATE_DAILY_BET_LIMIT_MUTATION, UPDATE_DAILY_DEPOSIT_LIMIT_MUTATION, UPDATE_MEMBER_ACCOUNT, UPDATE_MEMBER_VERIFICATION, UPDATE_MEMBER_VERIFICATION__NEXT, UPDATE_MOBILE_NUMBER, UPDATE_MONTHLY_BET_LIMIT_MUTATION, UPDATE_MONTHLY_DEPOSIT_LIMIT_MUTATION, UPDATE_REFERRAL_CODE, VERIFY_MOBILE_NUMBER, } from './queries.js';
|
|
4
|
+
import { ANNOUNCEMENTS, APPROVE_MEMBER_VERIFICATION__NEXT, CREATE_MEMBER_VERIFICATION, CREATE_MEMBER_VERIFICATION__NEXT, DELETE_MEMBER_ACCOUNT, FACEBOOK_CLIENT_ID, GENERATE_SUMSUB_VERIFICATION_TOKEN, GOOGLE_CLIENT_ID, MEMBER_ACCOUNT, MEMBER_VERIFICATION, PAYMENT_SETTINGS, POINTS_CLUB_SETTINGS, PROFILE_COMPLETION, REFERRAL_CODE, REGISTER_AGENT_ACCOUNT, REGISTER_MAYA_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT, REGISTER_MEMBER_ACCOUNT__NEXT, REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER, REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER_INPLAY, REGISTER_MEMBER_ACCOUNT_BY_NAME, REGISTER_MEMBER_ACCOUNT_VIA_MOBILE, REQUIRE_FIRST_DEPOSIT, RESET_PASSWORD, RESTRICT_WITHDRAWALS_TO_VERIFIED_MEMBERS, UNLINK_FACEBOOK, UNLINK_GOOGLE, UPDATE_DAILY_BET_LIMIT_MUTATION, UPDATE_DAILY_DEPOSIT_LIMIT_MUTATION, UPDATE_MEMBER_ACCOUNT, UPDATE_MEMBER_VERIFICATION, UPDATE_MEMBER_VERIFICATION__NEXT, UPDATE_MOBILE_NUMBER, UPDATE_MONTHLY_BET_LIMIT_MUTATION, UPDATE_MONTHLY_DEPOSIT_LIMIT_MUTATION, UPDATE_REFERRAL_CODE, VERIFY_MOBILE_NUMBER, } from './queries.js';
|
|
5
5
|
import { sha256 } from './sha256.js';
|
|
6
6
|
export const getMemberAccount = cache(async (options) => {
|
|
7
7
|
const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, MEMBER_ACCOUNT, undefined, options);
|
|
@@ -69,6 +69,24 @@ export const registerMemberAccountByMobileNumber = async (input, options) => {
|
|
|
69
69
|
throw error;
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
+
export const registerMemberAccountByMobileNumberInplay = async (input, options) => {
|
|
73
|
+
const { referralCode, ...rest } = input;
|
|
74
|
+
const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER_INPLAY, {
|
|
75
|
+
input: rest,
|
|
76
|
+
referralCode,
|
|
77
|
+
}, options);
|
|
78
|
+
const payload = res.registerMemberAccountByMobileNumber;
|
|
79
|
+
if (payload) {
|
|
80
|
+
const error = new Error();
|
|
81
|
+
error.name = payload.name;
|
|
82
|
+
error.message =
|
|
83
|
+
payload.message ||
|
|
84
|
+
ERROR_CODES_MESSAGE_MAP[payload.name] ||
|
|
85
|
+
'Something went wrong. Please try again later.';
|
|
86
|
+
Error.captureStackTrace?.(error, registerMemberAccountByMobileNumberInplay);
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
72
90
|
export const registerMemberAccount__next = async (input, options) => {
|
|
73
91
|
const { password, ...rest } = input;
|
|
74
92
|
const res = await graphqlRequest(ACCOUNT_GRAPHQL_ENDPOINT, REGISTER_MEMBER_ACCOUNT__NEXT, {
|
|
@@ -359,6 +377,8 @@ const ERROR_CODES_MESSAGE_MAP = {
|
|
|
359
377
|
FileDoesNotExistError: 'File does not exist',
|
|
360
378
|
FileNotReadyError: 'File is not yet ready',
|
|
361
379
|
InvalidPlatformError: 'Invalid platform',
|
|
380
|
+
InvalidAgentCodeError: 'Invalid agent code',
|
|
381
|
+
InvalidMobileNumberVerificationCodeError: 'Invalid mobile number verification code',
|
|
362
382
|
InvalidReCAPTCHAResponseError: 'Invalid reCAPTCHA',
|
|
363
383
|
InvalidSMSVerificationCodeError: 'Invalid SMS verification code',
|
|
364
384
|
InvalidTransactionPasswordError: 'You cannot use your account password as your transaction password.',
|
package/dist/services/auth.d.ts
CHANGED
|
@@ -25,7 +25,8 @@ export type CreateSessionInput = CreateSessionInput__UsernameAndPassword | Creat
|
|
|
25
25
|
/**
|
|
26
26
|
* Controls which auth endpoint is used to create a session.
|
|
27
27
|
* - `default` -> `${AUTH_ENDPOINT}/sessions` (or `/v3`/`/v4/sessions`, see `ApiVersion`)
|
|
28
|
-
* - `Inplay` -> `${AUTH_ENDPOINT}/v3/inplay/sessions
|
|
28
|
+
* - `Inplay` -> `${AUTH_ENDPOINT}/v3/inplay/sessions`, or `/v4/inplay/sessions`
|
|
29
|
+
* when `version` is `4` (any other version falls back to `v3`)
|
|
29
30
|
*/
|
|
30
31
|
export type VersionSession = 'default' | 'Inplay';
|
|
31
32
|
/**
|
|
@@ -59,7 +60,7 @@ export interface CreateSessionTwoFactorAuthEnabledMutation {
|
|
|
59
60
|
authenticator: Authenticator;
|
|
60
61
|
}
|
|
61
62
|
export type CreateSessionMutation = CreateSessionTwoFactorAuthDisabledMutation | CreateSessionTwoFactorAuthEnabledMutation;
|
|
62
|
-
export declare function createSession(input: CreateSessionInput, options?: HttpRequestOptions, versionSession?: VersionSession, version?: ApiVersion): Promise<CreateSessionMutation>;
|
|
63
|
+
export declare function createSession(input: CreateSessionInput, options?: HttpRequestOptions, versionSession?: VersionSession, version?: ApiVersion, authApiBaseUrl?: string | null): Promise<CreateSessionMutation>;
|
|
63
64
|
export declare function createSessionLibangan(input: CreateSessionInput__Libangan, options?: HttpRequestOptions): Promise<{
|
|
64
65
|
session: {
|
|
65
66
|
id: string;
|
|
@@ -80,8 +81,8 @@ export type AuthenticateInput = AuthenticateInput__SecurityQuestion;
|
|
|
80
81
|
export declare function authenticate(input: AuthenticateInput, options?: HttpRequestOptions): Promise<AuthenticateMutation>;
|
|
81
82
|
export interface RefreshSessionMutation extends Omit<CreateSessionTwoFactorAuthDisabledMutation, 'authenticator'> {
|
|
82
83
|
}
|
|
83
|
-
export declare function refreshSession(options?: HttpRequestOptions): Promise<RefreshSessionMutation>;
|
|
84
|
-
export declare function destroySession(options?: HttpRequestOptions): Promise<void>;
|
|
84
|
+
export declare function refreshSession(options?: HttpRequestOptions, version?: ApiVersion, authApiBaseUrl?: string | null): Promise<RefreshSessionMutation>;
|
|
85
|
+
export declare function destroySession(options?: HttpRequestOptions, authApiBaseUrl?: string | null): Promise<void>;
|
|
85
86
|
export declare function getSessionHealth(options?: HttpRequestOptions): Promise<boolean>;
|
|
86
87
|
export interface SendVerificationCodeInput {
|
|
87
88
|
strict?: boolean;
|
package/dist/services/auth.js
CHANGED
|
@@ -3,10 +3,10 @@ import { httpRequest } from './httpRequest.js';
|
|
|
3
3
|
import { sha256 } from './sha256.js';
|
|
4
4
|
function getSessionEndpoint(versionSession, version) {
|
|
5
5
|
if (versionSession === 'Inplay')
|
|
6
|
-
return
|
|
6
|
+
return `/v${version === 4 ? 4 : 3}/inplay/sessions`;
|
|
7
7
|
return version !== 1 ? `/v${version}/sessions` : '/sessions';
|
|
8
8
|
}
|
|
9
|
-
export async function createSession(input, options, versionSession = 'default', version = 1) {
|
|
9
|
+
export async function createSession(input, options, versionSession = 'default', version = 1, authApiBaseUrl) {
|
|
10
10
|
const isWeb = new Headers(options?.headers).get(PLATFORM_WEB_HEADER_KEY) === 'true';
|
|
11
11
|
const headers = new Headers();
|
|
12
12
|
if (input.type === 'NAME_AND_PASSWORD') {
|
|
@@ -48,14 +48,15 @@ export async function createSession(input, options, versionSession = 'default',
|
|
|
48
48
|
// Version 4 mirrors portal-sdk's `AuthService`: the auth server relies on
|
|
49
49
|
// its own cookie for web sign-ins, signalled via `?type=web`.
|
|
50
50
|
const queryParam = version === 4 && isWeb ? '?type=web' : '';
|
|
51
|
-
const
|
|
51
|
+
const path = getSessionEndpoint(effectiveVersionSession, version);
|
|
52
|
+
const baseUrl = authApiBaseUrl || AUTH_ENDPOINT;
|
|
52
53
|
try {
|
|
53
54
|
// v1 against the default endpoint returns the payload flat; every
|
|
54
55
|
// other combination (Inplay, or version 3/4) wraps it in `{ data: { ... } }`.
|
|
55
56
|
// Unwrap those so callers can treat both consistently via the existing
|
|
56
57
|
// `CreateSessionMutation` union.
|
|
57
58
|
if (effectiveVersionSession === 'Inplay' || version !== 1) {
|
|
58
|
-
const wrapped = await httpRequest.json(`${
|
|
59
|
+
const wrapped = await httpRequest.json(`${baseUrl}${path}${queryParam}`, {
|
|
59
60
|
...options,
|
|
60
61
|
method: 'POST',
|
|
61
62
|
headers,
|
|
@@ -72,7 +73,7 @@ export async function createSession(input, options, versionSession = 'default',
|
|
|
72
73
|
refreshToken: wrapped.data.refreshToken,
|
|
73
74
|
};
|
|
74
75
|
}
|
|
75
|
-
return await httpRequest.json(`${
|
|
76
|
+
return await httpRequest.json(`${baseUrl}${path}`, {
|
|
76
77
|
...options,
|
|
77
78
|
method: 'POST',
|
|
78
79
|
headers,
|
|
@@ -141,9 +142,12 @@ export async function authenticate(input, options) {
|
|
|
141
142
|
}
|
|
142
143
|
throw new Error("Invalid input 'type'");
|
|
143
144
|
}
|
|
144
|
-
export async function refreshSession(options) {
|
|
145
|
+
export async function refreshSession(options, version = 1, authApiBaseUrl) {
|
|
146
|
+
const url = authApiBaseUrl || AUTH_ENDPOINT;
|
|
145
147
|
try {
|
|
146
|
-
return await httpRequest.json(
|
|
148
|
+
return await httpRequest.json(version !== 1
|
|
149
|
+
? `${url}/v${version}/session/refresh`
|
|
150
|
+
: `${url}/session:refresh`, {
|
|
147
151
|
...options,
|
|
148
152
|
method: 'POST',
|
|
149
153
|
});
|
|
@@ -161,9 +165,10 @@ export async function refreshSession(options) {
|
|
|
161
165
|
}
|
|
162
166
|
}
|
|
163
167
|
}
|
|
164
|
-
export async function destroySession(options) {
|
|
168
|
+
export async function destroySession(options, authApiBaseUrl) {
|
|
169
|
+
const url = authApiBaseUrl || AUTH_ENDPOINT;
|
|
165
170
|
try {
|
|
166
|
-
await httpRequest(`${
|
|
171
|
+
await httpRequest(`${url}/session`, {
|
|
167
172
|
...options,
|
|
168
173
|
method: 'DELETE',
|
|
169
174
|
});
|
|
@@ -99,6 +99,7 @@ export declare const APPROVE_MEMBER_VERIFICATION__NEXT = "\n mutation SubmitMem
|
|
|
99
99
|
export declare const UPDATE_MEMBER_VERIFICATION__NEXT = "\n mutation UpdateMemberVerification($input: UpdateMemberVerificationInput!) {\n updateMemberVerification: updateMemberVerification_next(input: $input) {\n ... on FileDoesNotExistError {\n __typename\n }\n ... on FileNotReadyError {\n __typename\n }\n ... on MemberVerificationAlreadyApprovedError {\n __typename\n }\n ... on MemberVerificationDoesNotExistError {\n __typename\n }\n }\n }\n";
|
|
100
100
|
export declare const PROFILE_COMPLETION = "\n query ProfileCompletion {\n profileCompletion {\n completionPercentage\n personalInformation\n accountVerification\n mobileNumberVerification\n transactionPassword\n accountPassword\n }\n }\n";
|
|
101
101
|
export declare const REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER = "\n mutation RegisterMemberAccountByMobileNumber(\n $input: RegisterMemberAccountByMobileNumberInput!\n $mobileNumberVerificationCode: String!\n ) {\n registerMemberAccountByMobileNumber(\n input: $input\n mobileNumberVerificationCode: $mobileNumberVerificationCode\n ) {\n ... on MobileNumberNotAvailableError {\n name: __typename\n message\n }\n ... on InvalidSMSVerificationCodeError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n }\n }\n";
|
|
102
|
+
export declare const REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER_INPLAY = "\n mutation RegisterMemberAccountByMobileNumberInplay(\n $input: _RegisterMemberAccountByMobileNumberInput!\n $referralCode: String\n ) {\n registerMemberAccountByMobileNumber: _registerMemberAccountByMobileNumber(\n input: $input\n referralCode: $referralCode\n ) {\n ... on AccountNameNotAvailableError {\n name: __typename\n message\n }\n ... on MobileNumberNotAvailableError {\n name: __typename\n message\n }\n ... on EmailAddressNotAvailableError {\n name: __typename\n message\n }\n ... on InvalidMobileNumberVerificationCodeError {\n name: __typename\n message\n }\n ... on InvalidAgentCodeError {\n name: __typename\n message\n }\n ... on InvalidPlatformError {\n name: __typename\n message\n }\n ... on ReCAPTCHAVerificationFailedError {\n name: __typename\n message\n }\n ... on MemberAccountAlreadyExistsError {\n name: __typename\n message\n }\n }\n }\n";
|
|
102
103
|
export declare const PLATFORM = "\n query Platform {\n timezone\n currency\n }\n";
|
|
103
104
|
export declare const PAYMENT_SETTINGS = "\n fragment DepositGatewaySettingsCoreData on DepositGatewaySettings {\n minimumAmount\n maximumAmount\n webEnabled\n mobileWebEnabled\n androidEnabled\n iosEnabled\n bankAccountName\n bankAccountNumber\n bankIFSCCode\n upiId\n upiQRCode {\n id\n url\n }\n }\n\n fragment WithdrawalGatewaySettingsCoreData on WithdrawalGatewaySettings {\n minimumAmount\n maximumAmount\n webEnabled\n mobileWebEnabled\n androidEnabled\n iosEnabled\n }\n\n query PaymentSettings {\n minimumFirstDepositAmount\n restrictWithdrawalsToVerifiedMembers\n bankDepositGatewaySettings: depositGatewaySettings(gateway: BANK) {\n ...DepositGatewaySettingsCoreData\n }\n libanganDepositGatewaySettings: depositGatewaySettings(gateway: LIBANGAN_PAY_IN) {\n ...DepositGatewaySettingsCoreData\n }\n gcashDepositGatewaySettings: depositGatewaySettings(gateway: GCASH) {\n ...DepositGatewaySettingsCoreData\n }\n gcashWebpayDepositGatewaySettings: depositGatewaySettings(gateway: GCASH_WEBPAY) {\n ...DepositGatewaySettingsCoreData\n }\n aioGCashDepositGatewaySettings: depositGatewaySettings(gateway: AIO_GCASH) {\n ...DepositGatewaySettingsCoreData\n }\n aioPayMayaDepositGatewaySettings: depositGatewaySettings(gateway: AIO_PAY_MAYA) {\n ...DepositGatewaySettingsCoreData\n }\n aioGrabPayDepositGatewaySettings: depositGatewaySettings(gateway: AIO_GRAB_PAY) {\n ...DepositGatewaySettingsCoreData\n }\n aioPalawanPayDepositGatewaySettings: depositGatewaySettings(gateway: AIO_PALAWAN_PAY) {\n ...DepositGatewaySettingsCoreData\n }\n mayaDepositGatewaySettings: depositGatewaySettings(gateway: MAYA) {\n ...DepositGatewaySettingsCoreData\n }\n mayaAppDepositGatewaySettings: depositGatewaySettings(gateway: MAYA_APP) {\n ...DepositGatewaySettingsCoreData\n }\n mayaWebpayDepositGatewaySettings: depositGatewaySettings(gateway: MAYA_WEBPAY) {\n ...DepositGatewaySettingsCoreData\n }\n onlineBankDepositGatewaySettings: depositGatewaySettings(gateway: ONLINE_BANK) {\n ...DepositGatewaySettingsCoreData\n }\n qrphDepositGatewaySettings: depositGatewaySettings(gateway: QR_PH) {\n ...DepositGatewaySettingsCoreData\n }\n manualBankDepositGatewaySettings: depositGatewaySettings(gateway: MANUAL_BANK) {\n ...DepositGatewaySettingsCoreData\n }\n manualUPIDepositGatewaySettings: depositGatewaySettings(gateway: MANUAL_UPI) {\n ...DepositGatewaySettingsCoreData\n }\n pisoPayDepositGatewaySettings: depositGatewaySettings(gateway: PISO_PAY_CHECKOUT) {\n ...DepositGatewaySettingsCoreData\n }\n aurixPayGCashDepositGatewaySettings: depositGatewaySettings(gateway: AURIX_PAY_GCASH) {\n ...DepositGatewaySettingsCoreData\n }\n aurixPayGrabPayDepositGatewaySettings: depositGatewaySettings(gateway: AURIX_PAY_GRAB_PAY) {\n ...DepositGatewaySettingsCoreData\n }\n aurixPayPayMayaDepositGatewaySettings: depositGatewaySettings(gateway: AURIX_PAY_PAY_MAYA) {\n ...DepositGatewaySettingsCoreData\n }\n aurixPayQrphDepositGatewaySettings: depositGatewaySettings(gateway: AURIX_PAY_QR_PH) {\n ...DepositGatewaySettingsCoreData\n }\n bankWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: BANK) {\n ...WithdrawalGatewaySettingsCoreData\n }\n gcashWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: GCASH) {\n ...WithdrawalGatewaySettingsCoreData\n }\n gcashStandardCashInWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: GCASH_STANDARD_CASH_IN) {\n ...WithdrawalGatewaySettingsCoreData\n }\n mayaWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: MAYA) {\n ...WithdrawalGatewaySettingsCoreData\n }\n mayaAppWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: MAYA_APP) {\n ...WithdrawalGatewaySettingsCoreData\n }\n instapayWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: INSTAPAY) {\n ...WithdrawalGatewaySettingsCoreData\n }\n manualBankWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: MANUAL_BANK) {\n ...WithdrawalGatewaySettingsCoreData\n }\n manualUPIWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: MANUAL_UPI) {\n ...WithdrawalGatewaySettingsCoreData\n }\n ventajaWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: VENTAJA_DISBURSEMENT) {\n ...WithdrawalGatewaySettingsCoreData\n }\n pisoPayWithdrawalGatewaySettings: withdrawalGatewaySettings(gateway: PISO_PAY_REMITTANCE) {\n ...WithdrawalGatewaySettingsCoreData\n }\n }\n";
|
|
104
105
|
export declare const MAYA_SESSION = "\n query MayaSession($id: ObjectId!) {\n mayaSession(id: $id) {\n id\n member\n dateTimeCreated\n }\n }\n";
|
package/dist/services/queries.js
CHANGED
|
@@ -2659,6 +2659,50 @@ export const REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER = /* GraphQL */ `
|
|
|
2659
2659
|
}
|
|
2660
2660
|
}
|
|
2661
2661
|
`;
|
|
2662
|
+
export const REGISTER_MEMBER_ACCOUNT_BY_MOBILE_NUMBER_INPLAY = /* GraphQL */ `
|
|
2663
|
+
mutation RegisterMemberAccountByMobileNumberInplay(
|
|
2664
|
+
$input: _RegisterMemberAccountByMobileNumberInput!
|
|
2665
|
+
$referralCode: String
|
|
2666
|
+
) {
|
|
2667
|
+
registerMemberAccountByMobileNumber: _registerMemberAccountByMobileNumber(
|
|
2668
|
+
input: $input
|
|
2669
|
+
referralCode: $referralCode
|
|
2670
|
+
) {
|
|
2671
|
+
... on AccountNameNotAvailableError {
|
|
2672
|
+
name: __typename
|
|
2673
|
+
message
|
|
2674
|
+
}
|
|
2675
|
+
... on MobileNumberNotAvailableError {
|
|
2676
|
+
name: __typename
|
|
2677
|
+
message
|
|
2678
|
+
}
|
|
2679
|
+
... on EmailAddressNotAvailableError {
|
|
2680
|
+
name: __typename
|
|
2681
|
+
message
|
|
2682
|
+
}
|
|
2683
|
+
... on InvalidMobileNumberVerificationCodeError {
|
|
2684
|
+
name: __typename
|
|
2685
|
+
message
|
|
2686
|
+
}
|
|
2687
|
+
... on InvalidAgentCodeError {
|
|
2688
|
+
name: __typename
|
|
2689
|
+
message
|
|
2690
|
+
}
|
|
2691
|
+
... on InvalidPlatformError {
|
|
2692
|
+
name: __typename
|
|
2693
|
+
message
|
|
2694
|
+
}
|
|
2695
|
+
... on ReCAPTCHAVerificationFailedError {
|
|
2696
|
+
name: __typename
|
|
2697
|
+
message
|
|
2698
|
+
}
|
|
2699
|
+
... on MemberAccountAlreadyExistsError {
|
|
2700
|
+
name: __typename
|
|
2701
|
+
message
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
`;
|
|
2662
2706
|
export const PLATFORM = /* GraphQL */ `
|
|
2663
2707
|
query Platform {
|
|
2664
2708
|
timezone
|